1. Technical Field
The present invention relates generally to an improved data processing system, and in particular to a method and apparatus for processing graphics data. Still more particularly, the present invention provides a method and apparatus for switching context information to process graphics data for multiple graphics processes.
2. Description of Related Art
Data processing systems, such as personal computers and work stations, are commonly utilized to run computer-aided design (CAD) applications, computer-aided manufacturing (CAM) applications, and computer-aided software engineering (CASE) tools. Engineers, scientists, technicians, and others employ these applications daily. These applications involve complex calculations, such as finite element analysis, to model stress in structures. Other applications include chemical or molecular modeling applications. CAD/CAM/CASE applications are normally graphics intensive in terms of the information relayed to the user. Data processing system users may employ other graphics intensive applications, such as desktop publishing applications. Generally, users of these applications require and demand that the data processing systems be able to provide extremely fast graphics information.
The processing of a graphics data stream to provide a graphical display on a video display terminal requires an extremely fast graphics system to provide a display with a rapid response. In these types of graphics systems, primitives are received for processing and display. A primitive is a graphics element that is used as a building block for creating images, such as, for example, a point, a line, an arc, a cone, or a sphere. A primitive is defined by a group of one or more vertices. An attribute is used to define how a primitive will be displayed. Attributes include, for example, line style, color, and surface texture. A vertex defines a point, an end point of an edge, or a corner of a polygon where two edges meet. Data also is associated with a vertex in which the data includes information, such as positional coordinates, colors, normals, and texture coordinates. Commands are sent to the graphics system to define how the primitives and other data should be processed for display.
With the large amounts of data and computations involved in processing graphics data, especially with three-dimensional applications, many of these computations have been offloaded from the central processing units to a graphics adapter. Within these graphics systems, a graphics pipeline located in the graphics adapter is used to process this graphics data. With a pipeline, the graphics data processing is partitioned into stages of processing elements in which processing data may be executed sequentially by separate processing elements.
In a multi-tasking graphics environment, multiple processes often share the same graphics adapter. In order for each graphics process to send graphics data to the graphics adapter, each process requires a rendering context. This rendering context is restored on the graphics adapter by a context switch handler prior to the graphics data being sent to the graphics adapter from a particular graphics process for display. In a multi-tasking graphics environment for a particular graphics process to render graphics data, a set of registers in the graphics adapter are required to be restored to the proper state before any rendering command from the graphics process can be sent to an adapter first-in-first-out (FIFO) for processing. After the context has been restored, then the graphics process may send rendering commands to the adapter FIFO until its period of time or time slice has expired. When the time slice expires, the current graphics context information, such as those in the context registers are saved from the adapter to a memory, such as system memory. Then, the adapter FIFO may be accessed by another graphics process, which will start another cycle with the restoration of a context for that particular graphics process.
Before access to the FIFO is given to the next graphics process in the multi-tasking graphics environment, the processing of the current FIFO commands should be finished and the context save process for the prior graphics process should be finished. Currently, the current FIFO request or commands must be processed before the context is saved or the unprocessed FIFO requests or commands must be saved as part of the graphics context and restored during the next graphics context restore. In the first instance, the adapter FIFO waits for a new command to be sent after each context save instead of the command waiting in the adapter FIFO for processing. With the second case, the system waits for a direct memory access read/write of the adapter FIFO during each context switch with the system becoming input/output bound instead of taking advantage of a fast graphics processor on the adapter. In either case, delays in context switching and degradation graphics performance occurs.
Therefore, it would be advantageous to have an improved method and apparatus for switching contexts in a multi-tasking graphics environment.
The present invention provides a method and apparatus in a data processing system for asynchronous context switching. Requests of graphics processes are received to process graphics data for display in a queue in the graphics adapter. A current context is switched for a first graphics process to a new context for a second graphics process only in response to requests received in the queue. In this manner, the graphics adapter is able to continuously process commands in the queue instead of waiting for new commands to be sent after each context switch.